package com.hksj.wmp.auth;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class WxUsernamePasswordAuthenticationToken implements Authentication {

    private String username;

    private String password;

    private Object principal;

    private boolean authenticated = false;

    public WxUsernamePasswordAuthenticationToken(Object principal) {
        this.principal = principal;
        setAuthenticated(true);
    }

    public WxUsernamePasswordAuthenticationToken(String username, String devicePassword) {
        this.username = username;
        this.password = devicePassword;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public Object getDetails() {
        return null;
    }

    @Override
    public boolean isAuthenticated() {
        return this.authenticated;
    }

    @Override
    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
        this.authenticated = isAuthenticated;
    }

    @Override
    public String getName() {
        return this.username;
    }

    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return principal;
    }

    public String getPassword() {
        return password;
    }

}
